package cn.wolfcode.trip.core.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.Date;

@Setter
@Getter
public class StrategyComment extends BaseDomain {

    public static final int STATE_DISABLE = -1; // 禁用
    public static final int STATE_COMMON = 0; // 普通
    public static final int STATE_HOT = 1; // 推荐

    private User user;  // 评论人

    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime; // 评论时间

    private String content; // 评论内容

    private String imgUrls; // 评论时间

    private Integer starNum; // 星星数量

    private Strategy strategy; // 攻略

    private Integer state = STATE_COMMON; // 状态

    private Date commendTime; // 推荐时间

    public String[] getImgArr(){
        if(StringUtils.hasLength(imgUrls)){
            return imgUrls.split(";");
        }
        return null;
    }
}